<?php
/*
 * 焦点图推荐生成静态页
 */

if(!defined('IN_SITE') || !defined('IN_ADMIN')) {
	exit('Access Denied');
}

function getRecom($lid, $limit) {
	global $db, $tablepre;

	$sql = "SELECT lid, subject, summary, img, url, pubtime FROM {$tablepre}recommend WHERE lid='$lid' ORDER BY id DESC LIMIT $limit";
	$query = $db->query($sql);
	while ($row = $db->fetch_array($query)) {
		$focus[] = $row;
	}
	return $focus;
}

$lid = $_GET['lid'];
$filedir = SITE_ROOT.$_GET['filedir'];
switch ($lid) {
	case 1:
		//首页焦点图
		ob_start();
		$focus = getRecom(1, '0,6');
		$data = '<?xml version="1.0" encoding="utf-8"?>
<root imageWidth=\'440\' imageHeight=\'450\'>';
		foreach($focus as $k=>$v){
			$data .= '<menu url="#" frame="_blank" imageUrl="'.SITEURL.'/attachments'.$v['img'].'"/>';
		}
		$data .= '</root>';
		echo $data;
		break;
	case 2:
		//首页焦点图
		ob_start();
		$tag = getRecom(2, '0,1');
		include template("indexintro");
		break;
	case 3:
		//公司简介
		include SITE_ROOT.'data/cache/cache_category.php';
		ob_start();
		$tag = getRecom(3, '0,1');
		$path='intro';
		include template("singlepage");
		break;
	case 4:
		//技术实力
		include SITE_ROOT.'data/cache/cache_category.php';
		ob_start();
		$tag = getRecom(4, '0,1');
		$path='tec';
		include template("singlepage");
		break;
	case 5:
		//资质证书
		include SITE_ROOT.'data/cache/cache_category.php';
		ob_start();
		$tag = getRecom(5, '0,1');
		$path='cert';
		include template("singlepage");
		break;
	case 6:
		//联系我们
		include SITE_ROOT.'data/cache/cache_category.php';
		ob_start();
		$tag = getRecom(6, '0,1');
		$path='contact';
		include template("singlepage");
		break;
	case 7:
		//首页新闻
		ob_start();
		$tag = getRecom(7, '0,1');
		include template("indexnews");
		break;
	case 8:
		//首页新闻列表
		ob_start();
		$tag = getRecom(8, '0,5');
		include template("indexlist");
		break;
	case 9:
		//bander
		ob_start();
		$tag = getRecom(9, '0,5');
		include template("bander");
		break;
	case 10:
		//bander
		ob_start();
		$tag = getRecom(10, '0,10');
		include template("indexpro");
		break;
	case 11:
		//bander
		ob_start();
		$tag = getRecom(11, '0,5');
		include template("bander");
		break;
	case 12:
		//bander
		ob_start();
		$tag = getRecom(12, '0,5');
		include template("bander");
		break;
	case 13:
		//bander
		ob_start();
		$tag = getRecom(13, '0,5');
		include template("bander");
		break;
	case 14:
		//bander
		ob_start();
		$tag = getRecom(14, '0,5');
		include template("bander");
		break;
	case 15:
		//bander
		ob_start();
		$tag = getRecom(15, '0,5');
		include template("bander");
		break;

}

$filesize = createhtml($filedir);
showMessage("生成页面完成. 大小：".sizecount($filesize), "admincp.php?action=recommendlist&op=list");
?>